package com.sskj.mine.invite;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import com.lzy.okrx2.adapter.FlowableBody;
import com.sskj.common.base.HttpData;
import com.sskj.lib.http.JsonCallBack;
import com.sskj.lib.http.JsonConverter;
import com.sskj.mine.bean.InviteInfo;
import com.sskj.mine.bean.InviteRecord;
import com.sskj.mine.http.HttpConfig;
import com.sskj.mine.presenter.BasePresenter;
import com.sskj.mine.invite.RewardActivity;

import java.util.List;

import io.reactivex.Flowable;


/**
 * @author Hey
 * Create at  2019/05/03
 */
class RewardPresenter extends BasePresenter<RewardActivity> {

    public Flowable<List<InviteRecord.Invite>> getRecord(String page, String pageSize) {
        return OkGo.<HttpData<InviteRecord>>get(HttpConfig.BASE_URL + HttpConfig.INVITERECORD)
                .params("p", page)
                .params("size", pageSize)
                .converter(new JsonConverter<HttpData<InviteRecord>>() {
                })
                .adapt(new FlowableBody<>())
                .map(inviteRecordHttpData -> inviteRecordHttpData.getData().getRes());
    }
}
